home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / Universal Interfaces / PPCCIncludes / strstream.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-13  |  1.7 KB  |  82 lines  |  [TEXT/MPS ]

  1.  
  2. /*******************************************************************************/
  3. #ifndef STRSTREAMH
  4. #define STRSTREAMH
  5.  
  6. #ifndef IOSTREAMH
  7. #include <iostream.h>
  8. #endif
  9.  
  10. class strstreambuf : public streambuf
  11. {
  12. public: 
  13.             strstreambuf() ;
  14.             strstreambuf(int) ;
  15.             strstreambuf(void* (*a)(long), void (*f)(void*)) ;
  16.             strstreambuf(char* b, int size, char* pstart = 0 ) ;
  17.             strstreambuf(unsigned char* b, int size, unsigned char* pstart = 0 ) ;
  18.     int        pcount();
  19.     void        freeze(int n=1) ;
  20.     char*        str() ;
  21.             ~strstreambuf() ;
  22.  
  23. public: /* virtuals  */
  24.     virtual int    doallocate() ;
  25.     virtual int    overflow(int) ;
  26.     virtual int    underflow() ;
  27.     virtual streambuf*
  28.             setbuf(char*  p, int l) ;
  29.     virtual streampos
  30.             seekoff(streamoff,ios::seek_dir,int) ;
  31.  
  32. private:
  33.     void        init(char*,int,char*) ;
  34.  
  35.     void*        (*afct)(long) ;
  36.     void        (*ffct)(void*) ;
  37.     int        ignore_oflow ;
  38.     int        froozen ;
  39.     int        auto_extend ;
  40.  
  41. public:
  42.     int        isfrozen() { return froozen; }
  43.     } ;
  44.  
  45. class strstreambase : public virtual ios {
  46. public:
  47.     strstreambuf*    rdbuf() ;
  48. protected:    
  49.             strstreambase(char*, int, char*) ;
  50.             strstreambase() ;
  51.             ~strstreambase() ;
  52. private:
  53.     strstreambuf    buf ; 
  54.     } ;
  55.  
  56. class istrstream : public strstreambase, public istream {
  57. public:
  58.             istrstream(char* str);
  59.             istrstream(char* str, int size ) ;
  60.             ~istrstream() ;
  61.     } ;
  62.  
  63. class ostrstream : public strstreambase, public ostream {
  64. public:
  65.             ostrstream(char* str, int size, /*### int =ios::out ###*/int mode=ios::out) ;
  66.             ostrstream() ;
  67.             ~ostrstream() ;
  68.     char*        str() ;
  69.     int        pcount() ;
  70.     } ;
  71.  
  72.  
  73. class strstream : public strstreambase, public iostream {
  74. public:
  75.             strstream() ;
  76.             strstream(char* str, int size, int mode) ;
  77.             ~strstream() ;
  78.     char*        str() ;
  79.     } ;
  80.  
  81. #endif
  82.